package com.itheima.myreflect2.Student.demo;

import java.util.concurrent.CountDownLatch;

/**
 * @program: Myset
 * @description:
 * @author: xuejingjing
 * @create: 2021-06-20 15:35
 **/
public class MyCountLatchDemo {
    public static void main(String[] args) {
        //
        //等待线程的数量
        CountDownLatch countDownLatch = new CountDownLatch(3);

        //创建4个对象并开启他们
        ChildThread1 childThread1 = new ChildThread1(countDownLatch);
        ChildThread1 childThread2 = new ChildThread1(countDownLatch);
        ChildThread1 childThread3 = new ChildThread1(countDownLatch);

        childThread1.setName("小明");
        childThread2.setName("小刚");
        childThread3.setName("小红");

        childThread1.start();
        childThread2.start();
        childThread3.start();



    }
}
